﻿using System;
using Zove.Runtime;
using Zove.Scripting;
using EmbeddedSharp.Scripting;
using Zove.Scripting.Core;

namespace Zove.Scripting.Modelling {

    /// <summary>
    /// Show the inspect node
    /// </summary>
    public class InspectNode : ContextFuncNode {
        public InspectNode() :
            base("inspect") {
        }

        public ZoveScriptingContext ShellContext {
            get {
                return Context as ZoveScriptingContext;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override object Evaluate() {
            if (Parameters.Count < 1) {
                throw new ArgumentException(
                    "usage: inspect(model);");
            }

            string instanceName
                = Convert.ToString(Parameters[0].Evaluate());
            ModelInstance instance
                = ShellContext.GetInstance(instanceName);

            return string.Empty;
        }
    }
}
